<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            font-family: '微软雅黑';
        }
    </style>
</head>
<body>



<script>


  /* for(var i=0;i<6;i++){
       for(var k=0;k<6-i-1;k++){
           document.write(" ");
       }
       for(var j=0;j<=2*i;j++){
           document.write("*");
       }
       document.write("<br/>");
   }*/








        var a = prompt("请输入金字塔的层数");
       for(var i=0;i<a;i++) {
           for (var k = 0; k < a - i - 1; k++) {
               document.write("&nbsp");
           }
           for (var j = 0; j < 2 * i + 1; j++) {
               document.write("*");
           }
           document.write("<br />");
       }



   /*for (var i=1;i<40;i=i+2){
       for (var b=40;b>i;b=b-2){
           document.write("&nbsp;");
       }
       for (var c=0;c<i;c++){
           document.write("*")
       }
       document.write("<br>")
   }*/





</script>


</body>
</html>